const http = require('http');

const data = JSON.stringify({
  salesOrderId: "PO010",
  collectionDate: "2025-11-06",
  collectionMethod: "phone",
  responseResult: "已联系",
  nextFollowupDate: null,
  description: "1111",
  createdBy: 1
});

const options = {
  hostname: 'localhost',
  port: 9001,
  path: '/api/v1/collection-records',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': Buffer.byteLength(data)
  }
};

const req = http.request(options, res => {
  console.log(`状态码: ${res.statusCode}`);
  
  let responseData = '';
  res.on('data', chunk => {
    responseData += chunk;
  });
  
  res.on('end', () => {
    console.log('响应数据:', responseData);
  });
});

req.on('error', error => {
  console.error('请求错误:', error);
});

req.write(data);
req.end();